package com.jinglin.admin.controller;

import com.jinglin.controller.ABaseController;
import com.jinglin.entity.dto.TokenUserInfoDto;
import com.jinglin.entity.vo.PaginationResultVO;
import com.jinglin.entity.vo.ResponseVO;
import com.jinglin.entity.vo.VideoCommentResultVO;
import com.jinglin.service.VideoCommentService;
import com.jinglin.service.VideoDanmuService;
import org.apache.coyote.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/interact")
@Validated
public class InteractController extends ABaseController {
    @Autowired
    private VideoCommentService videoCommentService;
    @Autowired
    private VideoDanmuService videoDanmuService;
    @RequestMapping("/loadComment")
    public ResponseVO loadComment(Integer pageNo,Integer pageSize,String videoNameFuzzy){
        PaginationResultVO paginationResultVO = videoCommentService.loadCommentManage(null, pageNo, pageSize, null, videoNameFuzzy);
        return getSuccessResponseVO(paginationResultVO);
    }
    @RequestMapping("/loadDanmu")
    public ResponseVO loadDanmu(Integer pageNo,Integer pageSize,String videoNameFuzzy){
        PaginationResultVO paginationResultVO = videoDanmuService.loadDanmuManage(null, pageNo, pageSize, null,videoNameFuzzy);
        return getSuccessResponseVO(paginationResultVO);
    }
    @RequestMapping("/delComment")
    public ResponseVO delComment(String commentId ){
        videoCommentService.removeById(commentId);
        return getSuccessResponseVO(null);
    }

    @RequestMapping("/delDanmu")
    public ResponseVO delDanmu(String danmuId ){
        videoDanmuService.removeById(danmuId);
        return getSuccessResponseVO(null);
    }
}
